package com.example.demo2;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

@Component("studentbean")
public class StudentBean implements FactoryBean {


    @Override
    public Object getObject() throws Exception {
        //比如说 这里我new 一个 别的类型的
        return new TeacherBean();
    }

    @Override
    public Class<?> getObjectType() {
        return StudentBean.class;
    }

    public void study() {
        System.out.println("学生正在学习。。。。");
    }
}
